<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<% //Grab the username and emp_id from the session
String uname=(String)session.getAttribute("userName");
String emp_id=(String)session.getAttribute("emp_id");
int ei=Integer.parseInt(emp_id);
%>
<%
String query="select distinct(project.name) from project, task ,task_division where task_division.emp_id='"+ei+"'"+" and task.task_id=task_division.task_id and task.project_id=project.project_id";
Connection dbconn = null;
Statement stat = null;
PreparedStatement pstmnt;
ResultSet res;
try{
Class.forName("com.mysql.jdbc.Driver");
String url1= "jdbc:mysql://localhost:3306/db";
dbconn = DriverManager.getConnection( url1,"root", "root" );
stat = dbconn.createStatement();
res=stat.executeQuery(query);
while (res.next()) { // parse the results

//   out.print("<a href='"+"user.jsp?pageid=task&&tid="+tid+"'"+">"+tname+"</a> "+"  ");
out.print("<a href='"+"user.jsp?pageid=project&&projectName="+res.getString("project.name")+"'"+"> "+" "+res.getString("project.name")+" "+" </a>"+" "+" ");

}
dbconn.close();
} catch(SQLException e){
e.printStackTrace();
out.println("sql not found");
out.println(e);
} catch(ClassNotFoundException e){
e.printStackTrace();
out.println(e);
}

%>  